import React, { Component } from 'react'
import { Icon } from 'react-vant';
import axios from 'axios';

export default class HotspotDetail extends Component {

    state = {
        rdList: {}
    }

    go() {
        this.props.history.goBack(-1)
    }

    componentDidMount() {
        axios({
            url: '/api/rddetail',
            method: 'post',
            data: this.props.match.params
        }).then(res => {
            console.log(res);
            this.setState({
                rdList: res.data.data
            })
        })
    }

    render() {
        const { rdList } = this.state
        // {
        //     console.log(this.props);
        // }
        return (
            < div className='wrap' >
                <header>
                    <div className="detail">
                        <Icon name="arrow-left" className='icons' onClick={() => { this.go() }} />
                        <span>热点详情</span>
                    </div>
                </header>
                <main>
                    {
                        <div className="hotspot">
                            <img src={rdList.detailimg} alt="" />
                            <p>{rdList.introduce}</p>
                            <p>{rdList.detail}</p>
                            <img src={rdList.detailimg2} alt=""/>
                            <p>{rdList.detail2}</p>
                        </div>
                    }
                </main>
            </div >
        )
    }
}
